#include <iostream>
using namespace std;

//struct Student 
class Student {
public:
	//成员函数
	void eat (const string &food){
		cout << "我在吃"  << food << endl;
	}
	void sleep (int hour){
		cout << "我睡了"  << hour << " 小时" << endl;
	}
	void learn (const string &course) {
		cout << "我在学" << course << endl;
	}
	void who (void) {
		cout << "我是" << m_name << " , 今年" << m_age << " 岁, 学号是" << m_no << endl;
	}

	//成员变量
private:
	string m_name;
public:
	int m_age;
	int m_no;
	//可以使用共有的成员函数初始化私有的成员变量
	void setName (const string& name) {
		if (name == "二") {
			cout << "你才" << name << endl;
		} else {
			m_name = name;
		}

	}

};

int main (void)
{
	Student s;
	//s.m_name = "朱棣";
	s.m_age = 40;
	s.m_no = 10001;
	s.setName ("朱棣");

	s.who ();
	s.eat ("豆腐烩白菜");
	s.sleep (4);
	s.learn ("C++编程");
	return 0;
}
